import java.util.Scanner;

public class chengji {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        // 从键盘上读入学生成绩
        System.out.println("请输入学生成绩：");
        int score = scan.nextInt();
        
        // 方式一：使用if-else
        if (score >= 90 && score <= 100) {
            System.out.println("等级: A");
        } else if (score >= 70 && score < 90) {
            System.out.println("等级: B");
        } else if (score >= 60 && score < 70) {
            System.out.println("等级: C");
        } else if (score >= 0 && score < 60) {
            System.out.println("等级: D");
        } else {
            System.out.println("请输入有效成绩！");
        }
        
        // 方式二：使用switch-case
        switch (score / 10) {
            case 10:
            case 9:
                System.out.println("等级: A");
                break;
            case 8:
                System.out.println("等级: B");
                break;
            case 7:
                System.out.println("等级: C");
                break;
            case 6:
                System.out.println("等级: D");
                break;
            default:
                System.out.println("请输入有效成绩！");
        }
        
        scan.close();
    }
}
